<?php

function GetFilesList($db, $sourcefolder) {
    $sql = "SELECT filepath, filename, filesize, total_filesize, pwidth, pheight FROM cpg15x_pictures order by pid desc";
    $result = $db->query($sql);
    while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
        $str = $sourcefolder . $row['filepath'] . $row['filename'];
        $images[] = $str;
    }
    $result->free;
    shuffle($images);
    return ($images);
}

?>
